package jp.co.dangonet.rest.application;

import jp.co.dangonet.service.user.IUserLoginService;
import jp.co.dangonet.service.user.UserLoginService;



import org.apache.wink.common.internal.lifecycle.LifecycleManagersRegistry;
import org.apache.wink.guice.server.internal.GuiceDeploymentConfiguration;
import org.apache.wink.guice.server.internal.lifecycle.GuiceInjectorLifeCycleManager;
import org.apache.wink.guice.server.internal.lifecycle.WinkGuiceModule;

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;


public class DangoNetDeploymentConfiguration extends GuiceDeploymentConfiguration{
	public DangoNetDeploymentConfiguration() {
		super();
		LifecycleManagersRegistry lifecycleManagersRegistry = new LifecycleManagersRegistry();
		setOfFactoryRegistry(lifecycleManagersRegistry);
		Injector injector = Guice.createInjector(createModules());
		lifecycleManagersRegistry.addFactoryFactory(new GuiceInjectorLifeCycleManager<Object>(injector)); 
	}
	 public Module[] createModules() {
		 return new Module[]{new WinkGuiceModule(), new DBModule()};
	 }
	 private static final class DBModule extends AbstractModule {

		@Override
		protected void configure() {
			bind(IUserLoginService.class).to(UserLoginService.class);
		}
	 }
}
